import Vue from 'vue'
import VueRouter from 'vue-router'

// import HomeView from '../views/Home.vue'
import Home from '../pages/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    //重定向
    path: '/',
    redirect:'/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'homes',
        component: () => import( '../pages/home/Homes.vue')
        
      },
      {
        path: 'list',
        component: () => import( '../pages/home/List.vue')
        
      },
      {
        path: 'car',
        component: () => import( '../pages/home/Car.vue')
        
      },
      {
        path: 'my',
        component: () => import( '../pages/home/My.vue')
        
      },

    ]
 
  },
  {
    path: '/about',
    name: 'about',
    // 路由懒加载
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  // base 配置公共域名
  base: process.env.BASE_URL,
  routes
})

export default router
